MS-DOS:1.25:SCP Cromemco OEM/FUNKEY.DOC
A plain text file describing FUNKEY.EXE utility. File content Those of you who have function keys on your terminal's keyboard can customize these keys to work directly with the editing template as described in section 2.3 of the MS-DOS user's manual by running the MS-DOS utility file found in your System disk's directory under the name FUNKEY.EXE. A maximum of up to eleven function keys may be utilized. These keys can be programmed to work on the editing template for the following functions: 1. Copy one character from template 2. Skip over one character in template 3. Copy up to specified character 4. Skip up to specified character 5. Copy rest of template 6. Kill line with no change in template (Ctrl-X) 7. Cancel line and update template 8. Backspace (same as Ctrl-H) 9. Enter Insert Mode 10.Exit Insert Mode 11.Escape sequence to represent escape character If, for example, you have a terminal such as the Televideo 950 which has eleven function keys all commands for the editing template can be programmed. For terminals such as the ADDS Viewpoint which only has three funcion keys, you can program the most useful editing template commands such #3,#4,and #5 above. The lesser used commands can be utilized by such a terminal but not in such a convenient manner. To program the remaining functions you must enter the actual escape sequence when prompted. This procedure will be described in the discussion to follow. BACKGROUND: If your terminal has special function keys (commonly located on the top row of the keyboard as F1,F2,...) then you can have these keys programmed to edit the editing template. When a special function key is depressed by the user a sequence of characters are sent to the to the computer's input system. These characters usually come in bursts of two or three characters. MS-DOS uses only the first two characters as a legal escape sequence for working with the editing template and disposes of the third character if there is one. For example, the Televideo 925 and 950 terminals send the following character sequence when a function key F1 is depressed: first char > ASCII 1 (Ctrl-A) second char > ASCII 64 (@) third char > ASCII 13 (carriage return) The first character is denoted by MS-DOS as the "escape character". The second character represents the function to be performed. The third character is disposed by the operating system. Note: If you have a Televideo terminal you must make a simple modification to the IO.ASM file and reassemble it to tell the operating system that you want the third character in the sequence to be disposed otherwise the function keys will not work as expected after programming them. See the appendix to this document on editing the IO.ASM file to accomplish this task. For the Zenith Data Systems terminals, the function key F1 emits the following character sequence: first char > ASCII 21 (ESC key) second char > ASCII 83 (S) RUNNING FUNKEY.EXE To invoke FUNKEY.EXE simply type FUNKEY at the current drive. If the file is found on the disk it will begin running the program as follows: _______________________________________________________________________________ FUNCTION KEY MENU ( 0) End program ( 1) Copy one character from template ( 2) Skip over one character in template ( 3) Copy up to specified character ( 4) Skip up to specified character ( 5) Copy rest of template ( 6) Kill line with no change in template (Ctrl-X) ( 7) Cancel line and update template ( 8) Backspace (same as Ctrl-H) ( 9) Enter insert mode (10) Exit insert mode (11) Escape sequence to represent escape character ^ |_ 2nd char present escape char --> 1B hexadecimal Select menu item number _______________________________________________________________________________ The present escape character is a 1B hexadecimal (i.e. the ESC character). The second character is displayed on the left column enclosed in brackets. These characters will most likely change as you request different function keys that represent different characters. EXAMPLE SESSION (using a Televideo 950 terminal): (user responses quoted for distinction) ______________________________________________________________________________ Select menu item number "5" Press function key to Copy rest of template >>"press a function key here. Most function keys other than those of the Televideo will not emit a third character and the user must follow the function key by a carriage return. NOTE THAT THE ESCAPE SEQUENCE WILL NOT BE ECHOED TO THE SCREEN! If you do not have all the function keys needed you can manually input the character sequence and then retype this sequence when you need to use that function" Input escape character differs from that on the MSDOS system file Continue (Y/N)? "Y" "This will change the default escape character" More selections? (Y/N) "Y" _______________________________________________________________________________ Continue the process until all of your function keys are programmed as desired. NOTES: 1. You must note that the escape character must be the same throughout the session or the functions keys will not all work as expected. 2. At any time during the session you can abort by typing Ctrl-C. You may need to type this one or more times to get out. 3. If your wish the changes to be stored on the system of your disk be sure to respond to the "Save on disk? (Y/N) " prompt with a "Y" for yes. Otherwise the changes will remain in effect only until the system is rebooted. APPENDIX (Modifying the IO.ASM file to accomodate Televideo function keys) To modify IO.ASM use Perfect Writer to insert this portion of code into the appropriate place in the file. Follow the following procedure: 1. extract the code to follow and create its own file; call it PATCHIO.ASM 2. edit IO.ASM (PW IO.ASM) 3. find "; Console keyboard interrupt handler." 4. insert PATCH.ASM here 5. delete the corresponding previous code 6. end edit session 7. If the disk is in drive A: then type ASM IO.AAZ otherwise if it is in drive B: then type ASM IO.BBZ 8. HEX2BIN IO 9. INSTALL IO.COM (install the new IO system) 10. FUNKEY (run the function key programmer) ;---------------------------------------------------------------------------- ; PATCH TO HANDLE TELEVIDEO FUNCTION KEYS ; Console keyboard interrupt handler. ; KBINT: PUSH AX PUSH SI MOV AL,20H ;End of Interrupt command OUT BASE+2 ;Send to slave IN DATA ;Get the character AND AL,7FH CMP AL,"C"-"@" JZ FLSH CMP AL,"S"-"@" JZ FLSH CMP AL,"F"-"@" JZ FLSH CMP AL,"A"-"@" ; IF FUNCTION KEY STRUCK JNZ SAVKY ; SEG CS ; MOV B,SOHFLAG,03H ; SET SOHFLAG JMPS SAVKY ; ENDIF FLSH: CALL JFLUSH,BIOSSEG ; Call I/O system keyboard buffer flush. SAVKY: SEG CS MOV SI,REAR ;Pointer to rear of queue CALL INCQ SEG CS CMP SI,FRONT ;Any room in queue? JZ QFULL SEG CS CMP B,SOHFLAG,-1 JE PUTINCHARACTER SEG CS DEC B,SOHFLAG JNZ PUTINCHARACTER SEG CS DEC B,SOHFLAG CMP AL,0DH JNZ PUTINCHARACTER JMPS LEAVINT PUTINCHARACTER: SEG CS MOV SI,AL ;Put character in queue SEG CS MOV REAR,SI ;Save pointer LEAVINT: POP SI POP AX IRET QFULL: MOV AL,7 ; BELL character. CALL JOUT,BIOSSEG ; Call I/O system console output function. JMPS LEAVINT STATUS: PUSH SI DI ; Disable interrupts while checking queue. SEG CS MOV SI,FRONT SEG CS CMP SI,REAR ; Anything in queue? JZ NOCHR ; Jump if nothing in queue. CALL INCQ SEG CS LODSB ;Get character (if there is one) OR SI,SI ;Reset zero flag NOCHR: EI POP SI RET L ;Zero clear if we have a character INP: CALL JSTAT,BIOSSEG ; Get I/O system console input status. JZ INP PUSH SI DI ; Disable interrupts while changing queue pointers. SEG CS MOV SI,FRONT CALL INCQ ; Permanently remove char from queue SEG CS MOV FRONT,SI EI POP SI RET L FLUSH: DI SEG CS MOV REAR,QUEUE SEG CS MOV FRONT,QUEUE EI RET L INCQ: INC SI CMP SI,ENDQ ;Exceeded length of queue? JB RET MOV SI,QUEUE RET FRONT: DW QUEUE REAR: DW QUEUE QUEUE: DS QSIZE ENDQ: EQU $ SOHFLAG: DB -1 ENDIF ;_____________________________________________________________________________ �